package lpg;

class LookupSet<E>
{
    LookupSet(int initialCapacity, float loadFactor)
    {
        table = new LookupTable<E, Object>(initialCapacity, loadFactor);
    }

    LookupSet(int initialCapacity)
    {
        table = new LookupTable<E, Object>(initialCapacity);
    }

    LookupSet()
    {
        table = new LookupTable<E, Object>();
    }

    int size()
    {
        return table.size();
    }

    boolean isEmpty()
    {
        return table.isEmpty();
    }

    E find(Object o)
    {
        return table.findKey(o);
    }

    E findOrInsert(E e)
    {
        return table.findOrInsertKey(e, PRESENT);
    }

    void insert(E e)
    {
        table.insert(e, PRESENT);
    }

    E element(int i)
    {
        return table.key(i);
    }

    void reset()
    {
        table.reset();
    }

    private final LookupTable<E, Object> table;

    // Dummy value to associate with an Object in the backing Map
    private static final Object PRESENT = new Object();

}
